<?php

/**
 * GameResult form base class.
 *
 * @method GameResult getObject() Returns the current form's model object
 *
 * @package    edmuch
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseGameResultForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'           => new sfWidgetFormInputHidden(),
      'user_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('user'), 'add_empty' => false)),
      'start_date'   => new sfWidgetFormDateTime(),
      'end_date'     => new sfWidgetFormDateTime(),
      'result_xml'   => new sfWidgetFormInputText(),
      'rozgrywka_id' => new sfWidgetFormInputText(),
      'score'        => new sfWidgetFormInputText(),
      'score_max'    => new sfWidgetFormInputText(),
      'games_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('games'), 'add_empty' => false)),
    ));

    $this->setValidators(array(
      'id'           => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'user_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('user'))),
      'start_date'   => new sfValidatorDateTime(),
      'end_date'     => new sfValidatorDateTime(),
      'result_xml'   => new sfValidatorPass(array('required' => false)),
      'rozgrywka_id' => new sfValidatorInteger(array('required' => false)),
      'score'        => new sfValidatorInteger(array('required' => false)),
      'score_max'    => new sfValidatorInteger(array('required' => false)),
      'games_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('games'))),
    ));

    $this->widgetSchema->setNameFormat('game_result[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'GameResult';
  }

}
